<template>
	<view>

		<view class="center-group">
			<view v-if="cardList.length>0" class="card center-box" v-for="(item,index) in cardList" :key="index">
				<view class="left">
					<view class="img-box">
						<image class="img-icon" src="/static/myimages/m18.png" mode="widthFix"></image>
					</view>
					<view class="msg-box">
						<view class="vip-name">{{item.vipName || '会员名称'}}</view>
						<view class="vip-number">数量: {{item.number || 0}}</view>
					</view>
				</view>
				<view class="right">
					<view class="btn-1" @click="handldeActivate(item)">激活</view>
					<!-- <view class="btn-3" @click="cardLock(item)" v-if="valType==1">锁卡</view> -->
					<view class="btn-2" @click="handleZZ(item)">转赠</view>
				</view>
			</view>
			<view v-if="cardList.length==0" class="none">
				暂无信息
			</view>
		</view>
	</view>
</template>

<script>
	import {
		couponList
	} from '@/api/my.js'
	export default {
		data() {
			return {
				cardList: [],
				valType: 0
			};
		},
		methods: {
			getImg(item) {
				switch (item) {
					case 1:
						break;
					default:
						break;
				}
			},
			// 锁卡
			cardLock(item) {
				this.$emit('cardLock', item)
			},
			async getList(val) {
				this.valType = val
				let res = await couponList()
				if (val == 0) {
					this.cardList = res.data.filter(item => item.type != 2);
				}
				if (val == 1) {
					this.cardList = res.data.filter(item => item.type == 2);
				}
			},
			handldeActivate(item) {
				this.$emit('Activate', item)
			},
			handleZZ(item) {
				this.$emit('ZZ', item)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.none {
		width: 100%;
		height: 100rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #FFFFFF;
		opacity: 0.8;
	}

	.center-group {
		display: flex;
		flex-direction: column;
		gap: 20rpx;
		margin-bottom: 30rpx;
	}

	.center-box {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 24rpx;
	}

	.left {
		display: flex;
		align-items: center;

		.img-box {
			display: flex;
			align-items: center;
			justify-content: center;
			background-color: #165dff;
			border-radius: 50%;
			width: 80rpx;
			height: 80rpx;

			.img-icon {
				width: 40rpx;
				height: 40rpx;
				display: block;
				z-index: 2;
			}
		}

		.msg-box {
			margin-left: 20rpx;

			.vip-name {
				font-size: 28rpx;
				font-weight: 500;
				color: #f8fafc;
			}

			.vip-number {
				margin-top: rpx;
				font-size: 26rpx;
				font-weight: 500;
				color: #f8fafc;
			}
		}
	}

	.right {
		display: flex;
		align-items: center;
		gap: 20rpx;

		.btn-1 {
			padding: 10rpx 30rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 28rpx;
			font-weight: 500;
			color: #f8fafc;
			background: linear-gradient(135deg, #00ff9d, #00b8a9);
			border-radius: 10rpx;
		}

		.btn-3 {
			padding: 10rpx 30rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 28rpx;
			font-weight: 500;
			color: #f8fafc;
			background: linear-gradient(135deg, #64A7EC, #0E5298);
			border-radius: 10rpx;
		}

		.btn-2 {
			padding: 10rpx 30rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 28rpx;
			font-weight: 500;
			color: #f8fafc;
			background: linear-gradient(135deg, #7c3aed, #a855f7);
			border-radius: 10rpx;
		}
	}
</style>